//
//  WeCloudIMClient+Conversation.h
//  WeCloudChatDemo
//
//  Created by 与梦信息的Mac on 2022/4/14.
//  Copyright © 2022 WeCloud. All rights reserved.
//

#import "WeCloudIMClient.h"

NS_ASSUME_NONNULL_BEGIN

@interface WeCloudIMClient (Conversation)


/// 获取会话列表
/// @param completionBlock 请求回调
- (void)wcim_get_conversationList:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 根据会话id查询指定会话信息
/// @param conversationId 会话id
/// @param completionBlock 回调
- (void)wcim_get_conversationInfo:(long long)conversationId
                  completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 获取会话中成员表列表
/// @param conversationId 会话id
/// @param clientIds clientId列表，传了则只查询指定入参群成员
/// @param roles 角色列表 可多选，不传则查全部
/// @param muted 禁言开关 1-未禁言 2-禁言
/// @param completionBlock 回调
- (void)wcim_get_conversationMembers:(long long)conversationId
                           clientIds:(nullable NSArray *)clientIds
                               roles:(nullable NSArray *)roles
                               muted:(nullable NSString *)muted
                     completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 添加或修改会话成员备注
/// @param conversationId 会话id
/// @param remark 备注
/// @param completionBlock 回调
- (void)wcim_update_conversationMemberRemark:(long long)conversationId
                                      remark:(nonnull NSString *)remark
                             completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// 创建会话列表
/// @param name 会话名称 可选 对话的名字，可为群组命名
/// @param clientIds 可选 邀请加入会话的客户端,如创建单聊,则填入对方的clientId
/// @param chatType 会话属性，1：单聊，2：普通群，3：万人群
/// @param attributes 用户自定义参数
/// @param completionBlock 请求回调
- (void)wcim_post_createConversation:(nullable NSString *)name
                           clientIds:(nullable NSArray *)clientIds
                            chatType:(NSInteger)chatType
                          attributes:(nullable id)attributes
                     completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// 将用户添加进会话
/// @param conversationId 会话id
/// @param clientIds 要操作的clientId
/// @param completionBlock 回调
- (void)wcim_add_conversationClient:(long long)conversationId
                          clientIds:(nonnull NSArray *)clientIds
                    completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// 将client从会话移除
/// @param conversationId 会话id
/// @param clientIds 要操作的clientId
/// @param completionBlock 回调
- (void)wcim_delete_conversationClient:(long long)conversationId
                             clientIds:(nonnull NSArray *)clientIds
                       completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

#pragma mark - 待测试
/// 查询某个会话历史消息分页列表
/// @param conversationId 会话id
/// @param endMessageId 最后一条消息的ID
/// @param limit 分页数量
/// @param completionBlock 回调
- (void)wcim_get_conversationClient:(long long)conversationId
                       endMessageId:(long long)endMessageId
                              limit:(int)limit
                       completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

#pragma mark - 待测试
/// 查询某个会话历史消息分页列表2
/// @param conversationId 会话id
/// @param msgIdStart 第一条消息的ID
/// @param msgIdEnd 最后一条消息的ID
/// @param pageSorts 
/// @param pageIndex 页数
/// @param pageSize 分页数量
/// @param keyword 关键词
/// @param completionBlock 回调
- (void)wcim_get_historyMsgWitConversationId:(NSString *)conversationId
                                  msgIdStart:(NSString *__nullable)msgIdStart
                                    msgIdEnd:(NSString *__nullable)msgIdEnd
                                   pageSorts:(NSArray *__nullable)pageSorts
                                   pageIndex:(NSInteger )pageIndex
                                    pageSize:(NSInteger)pageSize
                                     keyword:(NSString * __nullable)keyword
                             completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 解散群聊
/// @param conversationId 会话id
/// @param completionBlock 回调
- (void)wcim_post_disbandConversation:(long long)conversationId
                      completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// client退出会话
/// @param conversationId 会话id
/// @param transfer 会话的创建者退出时,是否需要转移给下一个client, true为转移, false为不转移直接解散
/// @param completionBlock 回调
- (void)wcim_post_leaveConversation:(long long)conversationId
                           transfer:(BOOL)transfer
                    completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// 群禁言、取消群禁言
/// @param conversationId 会话id
/// @param mutedType 禁言类型 1.取消禁言 2.禁言
/// @param completionBlock 回调
- (void)wcim_post_conversationMutedGroup:(long long)conversationId
                               mutedType:(NSInteger)mutedType
                         completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 选择禁言
/// @param conversationId 会话id
/// @param mutedType 禁言类型 1.取消禁言 2.禁言
/// @param clientIds 禁言指定群成员列表
/// @param completionBlock 回调
- (void)wcim_post_conversationMutedGroup:(long long)conversationId
                               mutedType:(NSInteger)mutedType
                               clientIds:(nonnull NSArray *)clientIds
                         completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// 设置群管理员
/// @param conversationId 会话id
/// @param clientIds 要设置为群管理员的clientId列表
/// @param operateType 操作类型 1-设置管理员 2-删除管理员
/// @param completionBlock 回调
- (void)wcim_set_conversationGroupAdmins:(long long)conversationId
                               clientIds:(nonnull NSArray *)clientIds
                             operateType:(NSInteger)operateType
                         completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 群主转让
/// @param conversationId 会话id
/// @param clientId 即将成为群主的clientId
/// @param completionBlock 回调
- (void)wcim_post_conversationGroupTransferOwner:(long long)conversationId
                                        clientId:(NSString *)clientId
                                 completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;


/// 添加或修改会话名称
/// @param conversationId 会话id
/// @param name 会话名称
/// @param completionBlock 回调
- (void)wcim_update_conversationName:(long long)conversationId
                                name:(NSString *)name
                     completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

/// 修改会话未已读
/// @param conversationId 会话id
/// @param lastMsgId  最后一条消息ID
/// @param completionBlock 回调
- (void)wcim_update_conversation_read:(long long)conversationId
                              lastMsg:(NSInteger)lastMsgId
                     completionBlock:(nullable WCIMRequestCompletionBlock)completionBlock;

    
@end

NS_ASSUME_NONNULL_END
